/*
** Copyright (C) 2009 Joshua Brent Marsh <joshua@icub3d.com>
**  
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**  
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**  
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**  
*/

/* $Id$ */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>

#include <CUnit/Basic.h>

#include "../src/logger.h"

#include "test_logger.h"

int
init_test_logger_suite ()
{
  return 0;
}

int
clean_test_logger_suite ()
{
  fprintf (stderr, "\n>>>>> NOTICE: These functions are not unit tested. "
	   " You should verify the output in your system log for proper "
	   "testing. <<<<<\n");

  return 0;
}

void
test_logger ()
{
  logger_init ("test-logger", 0, LOG_LOCAL5);

  logger_log (LOG_INFO, "Basic logger, with INFO.");
  logger_dlog (LOG_INFO,
	       "Debug logger, with INFO and string '%s'.", "Hello!");
  logger_flog (LOG_WARNING, 
	       "Function logger, with WARNING and string '%s'.", "Good Bye!");

  logger_idlog (101091, LOG_INFO,
		"ID Debug logger, with INFO and string '%s'.", "Yo!");
  logger_iflog (101091, LOG_WARNING, 
		"ID Function logger, with WARNING and string '%s'.", "Peace!");

  logger_close ();
}

int
make_logger_suite (CU_pSuite s)
{
  s = CU_add_suite ("Test Logger Suite", 
		    init_test_logger_suite, 
		    clean_test_logger_suite);
  if (s == NULL)
    return CU_get_error();

  if (CU_add_test (s, "test logger", test_logger) == NULL)
    {
      return CU_get_error();
    }

  return CU_get_error();

}

